#coding=utf8
import ConfigParser, os, sys

class Getconfig(object):
    "get config"
    def __init__(self):
        self.config = ConfigParser.ConfigParser()
        self.config.readfp(open(os.path.join(os.path.split(os.path.abspath(sys.argv[0]))[0],'config')))

        self.debug = self.config.getint('CONFIG', 'debug')
        self.type = self.config.getint('CONFIG', 'type')

        self.logpath = os.path.join(os.path.split(os.path.abspath(sys.argv[0]))[0],self.config.get('CONFIG', 'logpath'))

        self.doctype = self.config.get('DOC', 'doctype')
        self.dbhost = self.config.get('DOC', 'dbhost')
        self.dbname = self.config.get('DOC', 'dbname')
        self.dbuser = self.config.get('DOC', 'dbuser')
        self.dbpassword = self.config.get('DOC', 'dbpassword')
        self.dbport = self.config.get('DOC', 'dbport')

        # if system is windows use gbk path ,else utf-8
        if sys.platform.find('win') != -1:
            self.win = True
        else:
            self.win = False
